<?php
function entity_import_datetime(Infinity\Entity &$entity, $field, array $value, array $field_data) {
  if(preg_match('/\d{1,2}\/\d{1,2}\/\d{4}/', $value[0])){
    $d = explode('/', $value[0]);
    $item = array(
      'value' => "{$d[2]}-{$d[1]}-{$d[0]}",
      'timezone' => 'Asia/Hong_Kong',
      'timezone_db' => 'Asia/Hong_Kong',
      'date_type' => 'datetime'
    );
    if(count($value) >= 2 && preg_match('/\d{1,2}\/\d{1,2}\/\d{4}/', $value[1])) {
      $d = explode('/', $value[1]);
      $item['value2'] = "{$d[2]}-{$d[1]}-{$d[0]}";
    }
    $entity->fieldManager()->setItem($field, $item);
  } else {
    watchdog('entity_import', 'error: entity_import_datetime():'.$value[0]);
  }
}